﻿@model App.Web.ViewModels.FeedbackViewModel
@using App.Web.Utility

@{
	String pageTitle = "Request Category";    
    ViewBag.Title = Html.GetPageTitle(pageTitle);
    bool _HasSent = ViewData[AppConstants.ViewDataKeys.HAS_ACTIVATED] == null ? false : Convert.ToBoolean(ViewData[AppConstants.ViewDataKeys.HAS_ACTIVATED]);
}
@Html.JavaScript("jquery.validate.min.js", Url)
@Html.JavaScript("jquery.validate.unobtrusive.min.js", Url)

<div class="page-heading">
    <h1>@pageTitle</h1>
    <div>
        Send request for new category. BDMarket24 team will contact you within next 72 hours in your given mobile number.        
    </div>
</div>

<div class="GroupBox">
    <div class="editor-label">
		Insert your required category with small details.
	</div>
	<div>
        <input id="categoryRequestBox" 
            style="width:500px"
            type="text" 
            value="" 
            name="" />
    </div>			
	<div id="footer_middle_button_2">
        <input id="btnRequestCategory" 
            style="cursor:pointer; margin-top:10px;"
            type="button" 
            value="Send" 
            onclick="javascript:SendRequest();"/>
    </div>
</div>

<div class="bm-dialog"  id="divMessageBox" style="display:none">
    <div>            
        <div class="bm-dialog-title">New Category Request</div>
    </div>
    <div class="bm-dialog-body" style="min-height:60px;" id="dvMsg">
                             
    </div>
    <div class="bm-dialog-button" style="height:15px;"></div>
</div>

<script language="javascript" type="text/javascript">

    //$(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);

    function SendRequest() {

        if ($("#btnRequestCategory").val() == "Send") {
            
            if ($('#categoryRequestBox').val() != '') {
                
                //$("#btnRequestCategory").val("new value");
                var url = '@Url.Action("SendCategoryRequest", "Feedback", new { area = AppConstants.Area.PUBLIC })';
                Ajax(url, 'mailBody=' + $('#categoryRequestBox').val(), function (isAdded) {
                    if (isAdded) {
                        ShowDialogMessage('Your category request sent to BDMarket24 team successfully');
                    }
                    else {
                        ShowDialogMessage('Problem sending mail! Please try again after a while.');
                    }
                }
            );
            }
            else
                ShowDialogMessage('Please insert category name you are looking for');

            $("#btnRequestCategory").val("Send");
        }
    }

    function ShowDialogMessage(Message) {
        var $msgDiv = $('#dvMsg');
        $msgDiv.show().html(Message);

        var $messageDiv = $('#divMessageBox');
        $messageDiv.show();
        setTimeout(function () { $messageDiv.hide(); }, 3000);
    }


    $(function () {
        $('#hidden').hide().click(function (e) {
            e.stopPropagation();
        });
        $("a.cart-buttom").click(function (e) {
            $('#hidden').animate({ opacity: "toggle" });
            $("#shopping-cart").animate({ "height": "toggle" }, { duration: 550 });
            e.stopPropagation();
        });
        $(document).click(function () {
            $('#hidden').fadeOut();
        });
    });

</script>